/*
** 2636.c
** 
** Made by (seakage2h)
** Login   <seakage2h@seakage2h-ubuntu>
** 
** Started on  Fri Oct  3 21:51:24 2008 seakage2h
** Last update Sun May 12 01:17:25 2002 Speed Blue
*/

/* #include "2636.h" */
#include <stdio.h>

int main()
{
     int instance, outlet, plugs, devices;

     scanf("%d", &instance);

     while(instance){
	  scanf("%d", &outlet);
	  devices = -outlet + 1;
	  while(outlet){
	       scanf("%d", &plugs);
	       devices += plugs;
	       outlet--;
	  }
	  printf("%d\n", devices);
	  
	  instance--;
     }
     return 0;
}

